package com.quanyan.riding.util;

import com.quanyan.riding.constans.Constans;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * CommonUtil
 *
 * @author Tu Chun
 * @date 2016/8/23
 */
public class CommonUtil {
    /**
     *获取车队口令
     * @param commandList
     * @return
     */
    public static List<Integer> getRandomCommand(List<Integer> commandList) {
        commandList = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < Constans.BIKE_COMMAND; i++) {
            int randomNum = 0;
            do {
                randomNum = random.nextInt(900000) + 100000;//100000~999999
            } while (commandList.contains(randomNum));
            commandList.add(randomNum);
        }
        return commandList;
    }
}
